\hypertarget{class_server}{
\section{\-Server \-Class \-Reference}
\label{class_server}\index{\-Server@{\-Server}}
}


\hyperlink{class_server}{\-Server} helper methods.  




{\ttfamily \#include $<$server.\-h$>$}

\subsection*{\-Public \-Slots}
\begin{DoxyCompactItemize}
\item 
\hypertarget{class_server_ab29aa2a33dd2662e95c5485b9bcec694}{
void \hyperlink{class_server_ab29aa2a33dd2662e95c5485b9bcec694}{handle\-Incoming\-Data} ()}
\label{class_server_ab29aa2a33dd2662e95c5485b9bcec694}

\begin{DoxyCompactList}\small\item\em \-Slot that gets called whenever there is incoming data from any socket to the server. \end{DoxyCompactList}\item 
\hypertarget{class_server_a782b2d9f22711ac0cca57e990dfb83d0}{
void \hyperlink{class_server_a782b2d9f22711ac0cca57e990dfb83d0}{handle\-Disconnection} ()}
\label{class_server_a782b2d9f22711ac0cca57e990dfb83d0}

\begin{DoxyCompactList}\small\item\em \-Slot that gets called whenever a client disconnects from the server. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{\-Signals}
\begin{DoxyCompactItemize}
\item 
void \hyperlink{class_server_afd11d6dc30d6fdf3ad5b30feb0c5c4ff}{remove\-Friend} (\hyperlink{classclient_information}{client\-Information} $\ast$person\-Sending\-Request, bool is\-Valid\-Request)
\begin{DoxyCompactList}\small\item\em \-Signal sent to remove friend. \end{DoxyCompactList}\item 
void \hyperlink{class_server_aa15d49a10e81b6c5f523f02663cdfb9d}{send\-Is\-Valid\-Remove\-Friend\-Request} (\-Q\-String person\-To\-Remove, bool is\-Valid\-Request)
\begin{DoxyCompactList}\small\item\em \-Signal to check if the remove request was valid. \end{DoxyCompactList}\item 
void \hyperlink{class_server_a4632a3440adaece614f553e84fcc67ef}{add\-Friend} (\-Q\-String person\-Sending\-Request)
\begin{DoxyCompactList}\small\item\em \-Signal sent to add a friend. \end{DoxyCompactList}\item 
void \hyperlink{class_server_a90fbc824ea7de283a02a268b510fd6f2}{send\-Is\-Valid\-Friend\-Request} (\-Q\-String person\-To\-Add, bool is\-Valid)
\begin{DoxyCompactList}\small\item\em \-Signal sent to check if the friend request was valid or not. \end{DoxyCompactList}\item 
void \hyperlink{class_server_a21329e064df7799d50e7d54a4b77f1d9}{confirm\-Friend\-Request} (\hyperlink{classclient_information}{client\-Information} $\ast$sent\-User, bool is\-Accepted)
\begin{DoxyCompactList}\small\item\em \-Signal sent to confirm friend request. \end{DoxyCompactList}\item 
void \hyperlink{class_server_ac46199c15eb4e607a039567c5cce900e}{send\-Message} (\-Q\-String from\-User, \-Q\-String to\-User, \-Q\-String message, \-Q\-String time\-Sent\-At)
\begin{DoxyCompactList}\small\item\em \-Signal to send message. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{\-Public \-Member \-Functions}
\begin{DoxyCompactItemize}
\item 
\hypertarget{class_server_a1950ac036d86af898428d7ba39bbf048}{
\hyperlink{class_server_a1950ac036d86af898428d7ba39bbf048}{\-Server} (\-Q\-Object $\ast$parent=0)}
\label{class_server_a1950ac036d86af898428d7ba39bbf048}

\begin{DoxyCompactList}\small\item\em \hyperlink{class_server}{\-Server} \-Constructor. \end{DoxyCompactList}\item 
bool \hyperlink{class_server_a4d28bcf39a54fac77bbd48872035e2c6}{start\-Server} (\-Q\-Host\-Address addr, quint16 port)
\begin{DoxyCompactList}\small\item\em \-Starts the server with the parameters passed in. \-Returns bool if successful or not. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{\-Protected \-Member \-Functions}
\begin{DoxyCompactItemize}
\item 
void \hyperlink{class_server_afeda4b86ff6555c7a5bb012d2f464d19}{incoming\-Connection} (int handle)
\begin{DoxyCompactList}\small\item\em \-Implements incoming\-Connection(handle) method in \-Q\-Tcp\-Server to handle any incoming connections. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{\-Private \-Member \-Functions}
\begin{DoxyCompactItemize}
\item 
\hypertarget{class_server_a6851a20573fcaed7ffc102da9521be61}{
void \hyperlink{class_server_a6851a20573fcaed7ffc102da9521be61}{handle\-Is\-Valid\-User\-Name} (\-Q\-Tcp\-Socket $\ast$person\-That\-Sent\-Data, \-Q\-String name\-Of\-User, bool is\-Valid\-Username)}
\label{class_server_a6851a20573fcaed7ffc102da9521be61}

\begin{DoxyCompactList}\small\item\em \-Method to check if the username sent was valid or not...deciding on whether or not to use. \end{DoxyCompactList}\item 
\hypertarget{class_server_a7261fe162d0d8492ca633965437ba00c}{
void \hyperlink{class_server_a7261fe162d0d8492ca633965437ba00c}{handle\-Incoming\-Friend\-Request} (\-Q\-String person\-Sending\-Request, \-Q\-String person\-Recieving\-Request, bool is\-Valid)}
\label{class_server_a7261fe162d0d8492ca633965437ba00c}

\begin{DoxyCompactList}\small\item\em \-Method to handle an incoming friend add request, \-Parameters are self-\/explanatory. \end{DoxyCompactList}\item 
\hypertarget{class_server_a0b5693825a399b5cf40e4e340e8b5b6b}{
void \hyperlink{class_server_a0b5693825a399b5cf40e4e340e8b5b6b}{handle\-Incoming\-Remove\-Friend\-Request} (\-Q\-String person\-Sending\-Request, \-Q\-String person\-To\-Remove)}
\label{class_server_a0b5693825a399b5cf40e4e340e8b5b6b}

\begin{DoxyCompactList}\small\item\em \-Method to handle an incoming friend remove request, \-Parameters are self-\/explanatory. \end{DoxyCompactList}\item 
\hypertarget{class_server_a4271c40116b94faaf57a6e75fa545f37}{
void \hyperlink{class_server_a4271c40116b94faaf57a6e75fa545f37}{update\-Users} ()}
\label{class_server_a4271c40116b94faaf57a6e75fa545f37}

\begin{DoxyCompactList}\small\item\em \-Iterates over the users connected and sends out the updated users connected \-Called whenever someone connects or disconnects. \end{DoxyCompactList}\item 
void \hyperlink{class_server_ad9a4fa699bda4ce299b919229fea6314}{satisfy\-Any\-Requests} (\hyperlink{classclient_information}{client\-Information} $\ast$user)
\begin{DoxyCompactList}\small\item\em \-Called when a user logs in and there are any requests to satisfy. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{\-Private \-Attributes}
\begin{DoxyCompactItemize}
\item 
\hypertarget{class_server_abe5cd00d6bdf190b8fd14b8cba47a0ce}{
\-Q\-Hash$<$ \-Q\-Tcp\-Socket $\ast$, \-Q\-String $>$ \hyperlink{class_server_abe5cd00d6bdf190b8fd14b8cba47a0ce}{user\-Socket\-String\-Table}}
\label{class_server_abe5cd00d6bdf190b8fd14b8cba47a0ce}

\begin{DoxyCompactList}\small\item\em \-Hashtable that contains the socket as the key and the username that's linked to the socket as the value. \end{DoxyCompactList}\item 
\hypertarget{class_server_a2ee26c91a91b2cc48f4ea7d5b2463a7b}{
\-Q\-Hash$<$ \-Q\-String, \*
\hyperlink{classclient_information}{client\-Information} $\ast$ $>$ \hyperlink{class_server_a2ee26c91a91b2cc48f4ea7d5b2463a7b}{user\-String\-Client\-Information\-Table}}
\label{class_server_a2ee26c91a91b2cc48f4ea7d5b2463a7b}

\begin{DoxyCompactList}\small\item\em \-Hashtable that contains the username as the key and the socket as the value. \end{DoxyCompactList}\item 
\hypertarget{class_server_a145ea61cfa694dee1fedef67f18c1f32}{
\-Q\-Hash$<$ \-Q\-String, \*
\hyperlink{classclient_information}{client\-Information} $\ast$ $>$ \hyperlink{class_server_a145ea61cfa694dee1fedef67f18c1f32}{overall\-Users}}
\label{class_server_a145ea61cfa694dee1fedef67f18c1f32}

\begin{DoxyCompactList}\small\item\em \-Table to store the friends lists of all the users that at one point have connected. \end{DoxyCompactList}\item 
\hypertarget{class_server_a77dfd551fe8d6d98b469a3181f11800f}{
\-Q\-Hash$<$ \hyperlink{classclient_information}{client\-Information} \*
$\ast$, \hyperlink{classclient_information}{client\-Information} $\ast$ $>$ \hyperlink{class_server_a77dfd551fe8d6d98b469a3181f11800f}{current\-Friend\-Requests}}
\label{class_server_a77dfd551fe8d6d98b469a3181f11800f}

\begin{DoxyCompactList}\small\item\em \-Stores the requests from and to the friend requests. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{\-Detailed \-Description}
\hyperlink{class_server}{\-Server} helper methods. 

\-Container class for the server containing all methods that require server connectivity 

\subsection{\-Member \-Function \-Documentation}
\hypertarget{class_server_a4632a3440adaece614f553e84fcc67ef}{
\index{\-Server@{\-Server}!add\-Friend@{add\-Friend}}
\index{add\-Friend@{add\-Friend}!Server@{\-Server}}
\subsubsection[{add\-Friend}]{\setlength{\rightskip}{0pt plus 5cm}void \-Server\-::add\-Friend (
\begin{DoxyParamCaption}
\item[{\-Q\-String}]{person\-Sending\-Request}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}signal\mbox{]}}}}
\label{class_server_a4632a3440adaece614f553e84fcc67ef}


\-Signal sent to add a friend. 


\begin{DoxyParams}{\-Parameters}
{\em person\-Sending\-Request} & \-The person sending the add friend request \\
\hline
\end{DoxyParams}
\hypertarget{class_server_a21329e064df7799d50e7d54a4b77f1d9}{
\index{\-Server@{\-Server}!confirm\-Friend\-Request@{confirm\-Friend\-Request}}
\index{confirm\-Friend\-Request@{confirm\-Friend\-Request}!Server@{\-Server}}
\subsubsection[{confirm\-Friend\-Request}]{\setlength{\rightskip}{0pt plus 5cm}void \-Server\-::confirm\-Friend\-Request (
\begin{DoxyParamCaption}
\item[{{\bf client\-Information} $\ast$}]{sent\-User, }
\item[{bool}]{is\-Accepted}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}signal\mbox{]}}}}
\label{class_server_a21329e064df7799d50e7d54a4b77f1d9}


\-Signal sent to confirm friend request. 


\begin{DoxyParams}{\-Parameters}
{\em sent\-User} & \-The user the request was sent to \\
\hline
{\em is\-Accepted} & \-Boolean value to determine if the friend request is accepted \\
\hline
\end{DoxyParams}
\hypertarget{class_server_afeda4b86ff6555c7a5bb012d2f464d19}{
\index{\-Server@{\-Server}!incoming\-Connection@{incoming\-Connection}}
\index{incoming\-Connection@{incoming\-Connection}!Server@{\-Server}}
\subsubsection[{incoming\-Connection}]{\setlength{\rightskip}{0pt plus 5cm}void \-Server\-::incoming\-Connection (
\begin{DoxyParamCaption}
\item[{int}]{handle}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}protected\mbox{]}}}}
\label{class_server_afeda4b86ff6555c7a5bb012d2f464d19}


\-Implements incoming\-Connection(handle) method in \-Q\-Tcp\-Server to handle any incoming connections. 


\begin{DoxyParams}{\-Parameters}
{\em handle} & \-The function gets called internally and the handle of the socket is passed \\
\hline
\end{DoxyParams}
\hypertarget{class_server_afd11d6dc30d6fdf3ad5b30feb0c5c4ff}{
\index{\-Server@{\-Server}!remove\-Friend@{remove\-Friend}}
\index{remove\-Friend@{remove\-Friend}!Server@{\-Server}}
\subsubsection[{remove\-Friend}]{\setlength{\rightskip}{0pt plus 5cm}void \-Server\-::remove\-Friend (
\begin{DoxyParamCaption}
\item[{{\bf client\-Information} $\ast$}]{person\-Sending\-Request, }
\item[{bool}]{is\-Valid\-Request}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}signal\mbox{]}}}}
\label{class_server_afd11d6dc30d6fdf3ad5b30feb0c5c4ff}


\-Signal sent to remove friend. 


\begin{DoxyParams}{\-Parameters}
{\em person\-Sending\-Request} & \-The person sending the remove friend request \\
\hline
{\em is\-Valid\-Request} & \-Boolean value to determine if the request is valid \\
\hline
\end{DoxyParams}
\hypertarget{class_server_ad9a4fa699bda4ce299b919229fea6314}{
\index{\-Server@{\-Server}!satisfy\-Any\-Requests@{satisfy\-Any\-Requests}}
\index{satisfy\-Any\-Requests@{satisfy\-Any\-Requests}!Server@{\-Server}}
\subsubsection[{satisfy\-Any\-Requests}]{\setlength{\rightskip}{0pt plus 5cm}void \-Server\-::satisfy\-Any\-Requests (
\begin{DoxyParamCaption}
\item[{{\bf client\-Information} $\ast$}]{user}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{class_server_ad9a4fa699bda4ce299b919229fea6314}


\-Called when a user logs in and there are any requests to satisfy. 


\begin{DoxyParams}{\-Parameters}
{\em \-The} & user that just logged on and we're checking if they have any pending requests \\
\hline
\end{DoxyParams}
\hypertarget{class_server_a90fbc824ea7de283a02a268b510fd6f2}{
\index{\-Server@{\-Server}!send\-Is\-Valid\-Friend\-Request@{send\-Is\-Valid\-Friend\-Request}}
\index{send\-Is\-Valid\-Friend\-Request@{send\-Is\-Valid\-Friend\-Request}!Server@{\-Server}}
\subsubsection[{send\-Is\-Valid\-Friend\-Request}]{\setlength{\rightskip}{0pt plus 5cm}void \-Server\-::send\-Is\-Valid\-Friend\-Request (
\begin{DoxyParamCaption}
\item[{\-Q\-String}]{person\-To\-Add, }
\item[{bool}]{is\-Valid}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}signal\mbox{]}}}}
\label{class_server_a90fbc824ea7de283a02a268b510fd6f2}


\-Signal sent to check if the friend request was valid or not. 


\begin{DoxyParams}{\-Parameters}
{\em person\-To\-Add} & \-The person so add to the friends list \\
\hline
{\em is\-Valid} & \-Boolean value to determine if the request is valid \\
\hline
\end{DoxyParams}
\hypertarget{class_server_aa15d49a10e81b6c5f523f02663cdfb9d}{
\index{\-Server@{\-Server}!send\-Is\-Valid\-Remove\-Friend\-Request@{send\-Is\-Valid\-Remove\-Friend\-Request}}
\index{send\-Is\-Valid\-Remove\-Friend\-Request@{send\-Is\-Valid\-Remove\-Friend\-Request}!Server@{\-Server}}
\subsubsection[{send\-Is\-Valid\-Remove\-Friend\-Request}]{\setlength{\rightskip}{0pt plus 5cm}void \-Server\-::send\-Is\-Valid\-Remove\-Friend\-Request (
\begin{DoxyParamCaption}
\item[{\-Q\-String}]{person\-To\-Remove, }
\item[{bool}]{is\-Valid\-Request}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}signal\mbox{]}}}}
\label{class_server_aa15d49a10e81b6c5f523f02663cdfb9d}


\-Signal to check if the remove request was valid. 


\begin{DoxyParams}{\-Parameters}
{\em person\-To\-Remove} & \-The person the user wishes to remove \\
\hline
{\em is\-Valid\-Request} & \-Boolean value to determine if the request is valid \\
\hline
\end{DoxyParams}
\hypertarget{class_server_ac46199c15eb4e607a039567c5cce900e}{
\index{\-Server@{\-Server}!send\-Message@{send\-Message}}
\index{send\-Message@{send\-Message}!Server@{\-Server}}
\subsubsection[{send\-Message}]{\setlength{\rightskip}{0pt plus 5cm}void \-Server\-::send\-Message (
\begin{DoxyParamCaption}
\item[{\-Q\-String}]{from\-User, }
\item[{\-Q\-String}]{to\-User, }
\item[{\-Q\-String}]{message, }
\item[{\-Q\-String}]{time\-Sent\-At}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}signal\mbox{]}}}}
\label{class_server_ac46199c15eb4e607a039567c5cce900e}


\-Signal to send message. 


\begin{DoxyParams}{\-Parameters}
{\em from\-User} & \-The from user \\
\hline
{\em to\-User} & \-The to user \\
\hline
{\em message} & \-The message being sent \\
\hline
{\em time\-Sent\-At} & \-The time the message was sent \\
\hline
\end{DoxyParams}
\hypertarget{class_server_a4d28bcf39a54fac77bbd48872035e2c6}{
\index{\-Server@{\-Server}!start\-Server@{start\-Server}}
\index{start\-Server@{start\-Server}!Server@{\-Server}}
\subsubsection[{start\-Server}]{\setlength{\rightskip}{0pt plus 5cm}bool \-Server\-::start\-Server (
\begin{DoxyParamCaption}
\item[{\-Q\-Host\-Address}]{addr, }
\item[{quint16}]{port}
\end{DoxyParamCaption}
)}}
\label{class_server_a4d28bcf39a54fac77bbd48872035e2c6}


\-Starts the server with the parameters passed in. \-Returns bool if successful or not. 


\begin{DoxyParams}{\-Parameters}
{\em addr} & \-The host address we want to start the server at \\
\hline
{\em port} & \-The port we want to start server from \\
\hline
\end{DoxyParams}


\-The documentation for this class was generated from the following files\-:\begin{DoxyCompactItemize}
\item 
/\-Users/plamontagna/\-Documents/spa-\/cs340project/\-Chat\-Server/\hyperlink{server_8h}{server.\-h}\item 
/\-Users/plamontagna/\-Documents/spa-\/cs340project/\-Chat\-Server/\hyperlink{server_8cpp}{server.\-cpp}\end{DoxyCompactItemize}
